import 'package:flutter/material.dart';
import '../../network/notify_listener.dart';
import 'view/news_line_painter.dart';
import 'view/news_time_view.dart';
import 'view/news_list.dart';

class NewsPage extends StatefulWidget {
  const NewsPage({super.key});

  @override
  State<NewsPage> createState() => _NewsPageState();
}

class _NewsPageState extends State<NewsPage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('News'),
      ),
      body: Column(
        children: [
          const NewsTimeView(),
          Expanded(
              child: CustomPaint(
            painter: NewsLinePainter(),
            child: const NewsList(),
          ))
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          NotifyCenter().postNotification(NotifyKey.newAddMsgKey);
        },
        child: const Icon(Icons.add),
      ),
    );
  }
}
